
//游游的水果大礼包
int main()
{
    int n = 0, m = 0;
    int a = 0, b = 0;
    cin >> n >> m >> a >> b;
    //计算最多可以组成多少个一号大礼包
    int num1 = std::min(n / 2, m);
    //然后枚举num1
    int maxValue = 0;
    for (int i = 0;i <= num1;++i)
    {
        int num2 = std::min((n - 2 * num1), (m - num1) / 2);
        maxValue = std::max(i * a + num2 * b, maxValue);
    }
    cout << maxValue;
    return 0;
}